home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Begin VB.Form split_frm
- Caption = "My own 'Split' function !!!"
- ClientHeight = 2490
- ClientLeft = 60
- ClientTop = 345
- ClientWidth = 3735
- Icon = "Split.frx":0000
- LinkTopic = "Form1"
- MaxButton = 0 'False
- ScaleHeight = 2490
- ScaleWidth = 3735
- StartUpPosition = 3 'Windows Default
- Begin VB.TextBox sep_txt
- Height = 285
- Left = 960
- TabIndex = 7
- Top = 480
- Width = 255
- End
- Begin VB.CommandButton effac_cbt
- Caption = "&Reset"
- Height = 255
- Left = 1440
- TabIndex = 6
- Top = 480
- Width = 975
- End
- Begin VB.ListBox result_lst
- Height = 1230
- ItemData = "Split.frx":000C
- Left = 120
- List = "Split.frx":000E
- TabIndex = 3
- TabStop = 0 'False
- Top = 840
- Width = 3495
- End
- Begin VB.CommandButton decoup_cbt
- Caption = "&Split !!!"
- Height = 255
- Left = 2640
- TabIndex = 5
- Top = 480
- Width = 975
- End
- Begin VB.TextBox chaine_txt
- Height = 285
- Left = 720
- TabIndex = 1
- Top = 120
- Width = 2895
- End
- Begin VB.Label sep_lbl
- Caption = "Seperator"
- Height = 255
- Left = 120
- TabIndex = 2
- Top = 510
- Width = 735
- End
- Begin VB.Label chaine_lbl
- Caption = "String"
- Height = 255
- Left = 120
- TabIndex = 0
- Top = 150
- Width = 495
- End
- Begin VB.Label nb_elem_lbl
- Alignment = 2 'Center
- Appearance = 0 'Flat
- BorderStyle = 1 'Fixed Single
- ForeColor = &H80000008&
- Height = 255
- Left = 120
- TabIndex = 4
- Top = 2160
- Width = 3495
- End
- Attribute VB_Name = "split_frm"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Option Explicit
- Private Sub Form_Load()
- Call effac_cbt_Click
- End Sub
- Private Sub decoup_cbt_Click()
- On Error GoTo erreur
- Dim tableau_a_remplir() As String
- Dim rep As Integer, nombre_elements As Integer, i As Integer
- rep = split(chaine_txt.Text, sep_txt.Text, tableau_a_remplir(), nombre_elements)
- If rep <> 0 Then GoTo erreur
- result_lst.Clear
- For i = 0 To nombre_elements - 1
- result_lst.AddItem tableau_a_remplir(i)
- result_lst.ListIndex = result_lst.ListCount - 1
- Next i
- nb_elem_lbl.Caption = "This string contains " & nombre_elements & " elements."
- Exit Sub
- erreur:
- MsgBox "Error n
- " & rep & vbCrLf & Error(rep), vbCritical, "Error"
- End Sub
- Private Sub effac_cbt_Click()
- chaine_txt.Text = "This" & Chr(127) & "is" & _
- Chr(127) & "my" & Chr(127) & "version" & _
- Chr(127) & "of" & Chr(127) & "the" & _
- Chr(127) & "Split" & Chr(127) & "fonction"
- sep_txt.Text = Chr(127)
- result_lst.Clear
- nb_elem_lbl.Caption = vbNullString
- End Sub
-